package dictx

type IDictionary[K comparable, V any] interface {
	GetData() map[K]V
	Reset(data map[K]V)
	Set(key K, value V)
	SetByMap(m map[K]V)
	SetBySet(other IDictionary[K, V])
	Get(key K) (V, bool)
	MustGet(key K) V
	Has(key K) bool
	Combine(other IDictionary[K, V])
	Delete(key K)
	Clear()
	Exists(key K) bool
	Length() int
	Pop(key K) (v V, exists bool)
	IsEmpty() bool
	Items() (items []V)
	Clone() (result *Dictionary[K, V])
	Keys() (keys []K)
	ForRange(handler func(key K, val V) (err error)) error
	First(handler func(key K, val V) bool) (result V)
	Filter(cond func(key K, val V) bool, target IDictionary[K, V]) IDictionary[K, V]
	Count(cond func(key K, val V) bool) int
	OnSet(handler func(key K, value V))
	OnDelete(handler func(key K, value V))
	GroupByCondition(createKey func(K, V) string, itemFactory func() IDictionary[K, V]) map[string]IDictionary[K, V]
}
